package com.king.client.model;

import com.king.client.util.ConstantsUtility;

/**
 * 抽象工厂类，主要用于各种URL的创建
 * 
 * @author Admin
 * 
 */
public abstract class YouKuUrlFactory implements IUrlFactory {
	public static final String mPidStr = "pid=72dcbabf24935d13";
	public static final String mPzStr = "pz=10";
	public static final String mRtStr = "rt=1";
	public static final String mFStr = "f=7";
	public static final String mLenStr = "len=120";

	public abstract String newUrlInstance();

	/**
	 * 拼接url路径
	 * 
	 * @param paras
	 *            参数值
	 * @return URL
	 */
	public String bulidUrl(String... paras) {
		StringBuilder builder = new StringBuilder();
		builder.append(ConstantsUtility.YOUKU_BASE_URL);
		builder.append(paras[0]);
		builder.append("?");

		int len = paras.length;
		for (int i = 1; i < len; i++) {
			builder.append(paras[i]);
			if (i == len - 1)
				break;
			builder.append("&");
		}

		return builder.toString();
	}

}
